<script setup>
import { useRouter } from 'vue-router'

const router = useRouter()
const goHome = () => {
  //go方法：按指定方向访问历史。如果是正数则是路由记录向前跳转，如果是负数则是向后回退
  //这里我们回退两个页面到跳转前的页面
  router.go(-2)
}
</script>

<template>
  <div class="exception">
    <div class="box">
      <h2>页面不存在</h2>
      <el-button plain type="primary" @click="goHome">返回上一个页面</el-button>
    </div>
  </div>
</template>

<style lang="less" scoped>
.exception {
  width: 100%;
  height: 100%;
  background-image: url('../assets/images/bj.jpg');
  background-size: cover;
  overflow: hidden;

  .box {
    width: 350px;
    font-size: 35px;
    margin: 200px auto;

    h2 {
      margin-bottom: 20px;
    }
  }
}
</style>
